#ifndef LOG_LOG_H
#define LOG_LOG_H

#include <glog/logging.h>
#include <glog/raw_logging.h>

namespace GlogWrapper{
    typedef int vSeverity;
    const int PROCESS_STATE = 2;
    const int DETAILED_INFO = 3;

    void setLogEnv(bool isLogToConsole, std::string logPath, google::LogSeverity logLevel, vSeverity v);
    void initialLog(char* projectName);
    bool isNeededLog(google::LogSeverity logSeverity, vSeverity v);
    template<typename T>
    void
    loopWithSpecifiedDelimeter(std::vector<T> elements, std::string delimeter, google::LogSeverity logSeverity, vSeverity v)
    {
        if(isNeededLog(logSeverity, v))
        {
            google::LogMessage log(__FILE__, __LINE__, logSeverity);
            for(auto ele: elements)
                log.stream()<<ele<<delimeter;
        }
    }
    template<typename T>
    void loopWithSpecifiedDelimeter(std::vector<std::vector<T>> elements, std::string delimeterForOuter,
                                    std::string delimeterForInner, google::LogSeverity logSeverity, vSeverity v)
    {
        if(isNeededLog(logSeverity, v))
        {
            google::LogMessage log(__FILE__, __LINE__, logSeverity);
            for(auto ele: elements)
            {
                for(auto e: ele)
                    log.stream()<<e<<delimeterForInner;
                log.stream()<<delimeterForOuter;
            }
        }
    }
}
#endif //LOG_LOG_H